using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using AandEDLL;
using AandEDLL.DataAccess;

namespace ASA
{
    public partial class AdminForm : Form
    {
        public AdminForm()
        {
            InitializeComponent();
        }

        private void addUserButton_Click(object sender, EventArgs e)
        {
         
            
            //User[] users = new User[1];

            //preston,  we are not going to use the array any more
            //we will now just do a single user at a time

            User user = new User();

            user.Password = passwordTextBox.Text;
            user.UserName = userNameTextBox.Text;
            user.Admin = AdminPrivCheckBox.Checked;
            user.LastLoginDate = DateTime.Now;
            
            //to do   validation error checking
           // users[0] = user;

            try
            {
               

                //AandEDLL.Accessor.InsertUser(users);
                
            }

            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
               
                
            }
            


          
           // user.UserName = userNameTextBox.Text.ToString();

           // user.Password = passwordTextBox.Text.ToString();
            //user.Admin = true;
            //user.LastLoginDate = DateTime.Now;

           
        }
    }
}